package checkers.server.logic.classes;

import java.io.IOException;

import checkers.common.logic.commands.AuthorizeRequest;
import checkers.common.logic.commands.RegisterRequest;


public class RegistrationManager {
	
	//PrintWriter out;
	
	public RegistrationManager() throws IOException {
		//out = new PrintWriter(new BufferedWriter(new FileWriter("players.txt")));
	}

	public boolean register(RegisterRequest player) {
		//out.println(player.getId() + " " + player.getLogin());
		//out.flush();
		Player p = new Player();
		p.setLogin(player.getLogin());
		GameContext.getInstance().addPlayer(p);
		return true;
	}
	
	public boolean isRegistered(AuthorizeRequest player) {
		return GameContext.getInstance().getPlayerById(player.getId()) != null;
	}
	
}
